package main

import (
	"github.com/huntsman-li/iris-swagger"
	"github.com/huntsman-li/iris-swagger/swaggerFiles"
	"github.com/kataras/iris"
	"github.com/kataras/iris/mvc"
	"tizhi_front/controllers"
	_ "tizhi_front/docs"
	"tizhi_front/nspel"
)

// @version 0.1
// @Title nspel front end
// @Description nspel documents for your API
// @contact.email 1156226746@qq.com or 303654306@qq.com
// @BasePath /v1
func main() {
	app := iris.Default()
	runner := nspel.Config(app)
	mvc.Configure(app.Party("/v1/user"), func(application *mvc.Application) {
		application.Handle(new(controllers.UserController))
	})
	mvc.Configure(app.Party("/v1/prescription"), func(application *mvc.Application) {
		application.Handle(new(controllers.PrescriptionController))
	})
	mvc.Configure(app.Party("/v1/msm_code"), func(application *mvc.Application) {
		application.Handle(new(controllers.MsmCodeController))
	})
	mvc.Configure(app.Party("/v1/course"), func(application *mvc.Application) {
		application.Handle(new(controllers.CourseController))
	})
	mvc.Configure(app.Party("/v1/consult"), func(application *mvc.Application) {
		application.Handle(new(controllers.ConsultController))
	})
	mvc.Configure(app.Party("/v1/config"), func(application *mvc.Application) {
		application.Handle(new(controllers.ConfigController))
	})
	mvc.Configure(app.Party("/v1/article"), func(application *mvc.Application) {
		application.Handle(new(controllers.ArticleController))
	})
	mvc.Configure(app.Party("/v1/evaluation"), func(application *mvc.Application) {
		application.Handle(new(controllers.EvaluationController))
	})
	mvc.Configure(app.Party("/v1/message"), func(application *mvc.Application) {
		application.Handle(new(controllers.MessageController))
	})
	app.Get("/swagger/*any", swagger.WrapHandler(swaggerFiles.Handler))
	err := app.Run(runner)
	if err != nil {
		panic(err)
	}
}
